package dancrawler.proto.cmd;

import dancrawler.proto.cmd.NetCommand;
import dancrawler.server.netMsg;

/**
 *
 */
public class Command implements NetCommand {
    protected int[] args;
    private int id;
    private CmdHandler handler;
    public Command(int id, int[] argsSize)
    {
        if(argsSize != null)
        {
            args = argsSize.clone();
        }
    }
    public Command(int id, int[] argsSize, CmdHandler h)
    {
        this.handler = h;
        if(argsSize != null)
        {
            args = argsSize.clone();
        }
    }
    
    @Override
    public int getNumArgs()
    {
        if(args == null)
            return 0;
        return args.length;
    };
    @Override
    public int getArgSize(int n)
    {
        if(args == null || args.length < n)
        {
            return 0;
        }
        return args[n];
    };

    @Override
    public CmdHandler getHandler() {
        return handler;
    }

    @Override
    public int getId() {
        return id;
    }
}
